package com.dwork.base.utils;

public class StringUtil {

	public static String join(Object[] a, String separator) {
		if(a==null||a.length==0) {
			return null;
		}
		if(a.length==1) {
			return a[0]+"";
		}
		String str = a[0]+"";
		for(int i=1;i<a.length;i++) {
			str += separator+a[i];
		}
		return str;
	}
	
	public static String join(Object[] a, String pre, String end, String separator) {
		if(a==null||a.length==0) {
			return null;
		}
		if(a.length==1) {
			return pre+a[0]+end;
		}
		String str = pre+a[0]+end;
		for(int i=1;i<a.length;i++) {
			str += separator+pre+a[i]+end;
		}
		return str;
	}
	
	public static Boolean isExists(String s,String[] ss){
		if(s==null||ss==null)
			return false;
		for(String v:ss){
			if(v.equals(s)){
				return true;
			}
		}
		return false;
	}
}
